﻿using UnityEngine;
using UnityEditor;
public class TranserToSprite : AssetPostprocessor
{

    //当导入图片的时候自动调用
    void OnPreprocessTexture()
    {

        if (assetImporter.assetPath.Contains("UI") && assetImporter.assetPath.Contains(".png"))//根据名字判断是否是UI资源
        {
            TextureImporter texImpoter = assetImporter as TextureImporter;
            texImpoter.textureType = TextureImporterType.Sprite;
            Debug.Log(assetImporter.assetPath);
        }
    }
}

